project(testMeNoteTree_sqlite)

add_custom_command(OUTPUT [ ${CMAKE_CURRENT_SOURCE_DIR}/notetree-odb.hxx, ${CMAKE_CURRENT_SOURCE_DIR}/notetree-odb.cxx, ${CMAKE_CURRENT_SOURCE_DIR}/notetree-odb.ixx ]
        PRE_BUILD
        COMMAND echo "-----testMeNoteTree_sqlite---------"
        COMMAND odb -I /usr/include/x86_64-linux-gnu/qt5 --std c++11 -DQT_BOOTSTRAPPED -d sqlite --profile qt --generate-schema --generate-query --generate-session ${CMAKE_CURRENT_SOURCE_DIR}/notetree.h
        WORKING_DIRECTORY ..)



#过滤文件
file(GLOB source
        "*.hxx"
        "*.cxx"
        "*.h"
        "*.cpp"
        )

pkg_search_module(ODB_SQLITE  REQUIRED libodb-sqlite)
find_library(ODB_SQLITE_LIBRARY_VAR
        NAMES ${ODB_SQLITE_LIBRARIES}
        HINTS ${ODB_SQLITE_LIBRARY_DIRS} ${ODB_SQLITE_LIBDIR})


add_executable(${PROJECT_NAME} ${source})

target_link_libraries(${PROJECT_NAME}
        PUBLIC Qt5::Core
        PRIVATE ${ODB_LIBRARY_VAR}
        PRIVATE  ${ODB_SQLITE_LIBRARY_VAR}
        PRIVATE  ${ODB_QT_LIBRARY_VAR})